# coding=utf-8
import redis
import logging


class Config(object):
    """工程配置信息"""
    DEBUG = True

    SECRET_KEY = '6RXC2wN1f4rUrsH2+eaPCOOhqo7DCNHe0p9MFChhsI8='

    # 数据库的配置信息
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1/information9'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True

    # 配置redis
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    # flask_session的配置信息
    SESSION_TYPE = 'redis'
    SESSION_USE_SIGNER = True
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    PERMANENT_SESSION_LIFETIME = 86400  # session 的有效期，单位是秒


# 项目多种配置
class DevelopementConfig(Config):
    """开发环境下的配置"""
    DEBUG = True
    # REDIS_HOST = 'localhost'
    # REDIS_PORT = 6379
    LOG_LEVEL = logging.DEBUG


class ProductionConfig(Config):
    """生产环境下的配置"""
    DEBUG = False
    LOG_LEVEL = logging.WARNING




